using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using Entities;
using BUS;
using DAL;
namespace BUS
{
    public class tbMaSoSPBUS
    {
        public static void Insert(tbMaSoSP MS)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Insert(MS);
        }
        public static void Update(tbMaSoSP MS)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Update(MS);
        }
        public static void Delete(int iD)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            masospDAL.Delete(iD);
        }
        public static tbMaSoSPCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            return masospDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbMaSoSPCollection GetAll()
        {
            int total = 0;
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            return masospDAL.Get("where 1=1", 0, 0, tbMaSoSPColumns.IdMaSoSP.ToString(), "ASC", out total);
        }
        public static tbMaSoSP GetByID(int iD)
        {
            int total = 0;
            tbMaSoSPDAL masospDAL = new tbMaSoSPDAL();
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbMaSoSPColumns.IdMaSoSP.ToString(), Condition.EQUAL, iD);
            tbMaSoSPCollection masospCollection = masospDAL.Get(cri .Criter ,0,0,tbMaSoSPColumns .IdMaSoSP .ToString (),
                                                    OrderDirection .ASC .ToString (),out total );
            if (masospCollection.Count > 0)
                return masospCollection[0];
            return null;
        }
    }
}
